package com.chinacoal.microservice.mapper;


import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRoom;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-房间管理-mybatis-plus的接口类
 * @date 2020-11-12 11：00
 */
public interface CcmsSmartleasingRoomMapper extends BaseMapper<CcmsSmartleasingRoom> {
    /**
     * @Description: 批量删除（批量修改）
     * @author zhuliang
     * @date 2020/11/12 11:51
     */
    void updateToDeleteById(@Param("deleteSign") String deleteSign,
                            @Param("lastUpdateDate") Date lastUpdateDate,
                            @Param("pkRoomId") String[] pkRoomId,
                            @Param("lastUpdatedBy") Integer lastUpdatedBy,
                            @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 根据楼宇id查询所有的房间信息
     * @author zhuliang
     * @date 2020/11/16 12:01
     */
    List<CcmsSmartleasingRoom> getAllByBuildingId(@Param("fkBuildingId") String fkBuildingId);

    /**
     * @Description: 分页查询所有的房间信息（带分页）
     * @author zhuliang
     * @date 2020/11/19 15:38
     */
    List<CcmsSmartleasingRoom> getAllByPage(Page<CcmsSmartleasingRoom> toPage,
                                            @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 查询所有符合条件的信息
     * @author zhuliang
     * @date 2020/11/19 15:39
     */
    Long getAllByPage_COUNT(@Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询，查询总记录数
     * @author zhuliang
     * @date 2020/11/19 17:06
     */
    Long getAllByCondition_COUNT(@Param("fkBuildingId") String fkBuildingId,
                                 @Param("fkHouseTypeId") String fkHouseTypeId,
                                 @Param("roomName") String roomName,
                                 @Param("areaNumberId") String areaNumberId,
                                 @Param("unitCoding") String unitCoding,
                                 @Param("roomStatus") String roomStatus,
                                 @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                 @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询所有的房间记（带分页）
     * @author zhuliang
     * @date 2020/11/19 17:07
     */
    List<CcmsSmartleasingRoom> getAllByCondition(Page<CcmsSmartleasingRoom> toPage,
                                                 @Param("fkBuildingId") String fkBuildingId,
                                                 @Param("fkHouseTypeId") String fkHouseTypeId,
                                                 @Param("roomName") String roomName,
                                                 @Param("areaNumberId") String areaNumberId,
                                                 @Param("unitCoding") String unitCoding,
                                                 @Param("roomStatus") String roomStatus,
                                                 @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                 @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 根据房间id查询房间信息
     * @author zhuliang
     * @date 2020/11/19 17:55
     */
    CcmsSmartleasingRoom getRoomById(@Param("pkRoomId") String pkRoomId,
                                     @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                     @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 根据楼宇id查询房间数
     * @author zhuliang
     * @date 2020/11/24 15:27
     */
    String getCountByBuildingId(@Param("fkBuildingId") String fkBuildingId);

    /**
     * @Description: 根据户型id查询房间数
     * @author zhuliang
     * @date 2020/11/24 15:42
     */
    String getCountByHouseTypeId(@Param("fkHouseTypeId") String fkHouseTypeId);

    /**
     * @Description: 根据费用系数id查询房间数
     * @author zhuliang
     * @date 2020/11/25 20:58
     */
    String getCountByCoefficientId(@Param("fkCoefficientTemplateId") String fkCoefficientTemplateId);

    /**
     * @Description: 根据费用模板id查询房间信息
     * @author zhuliang
     * @date 2020/11/30 19:31
     */
    List<CcmsSmartleasingRoom> getRoomByCoefficientId(@Param("fkCoefficientTemplateId") String fkCoefficientTemplateId);

    /**
     * @Description: 退租房间状态
     * @author zhuliang
     * @date 2020/12/2 17:48
     */
    void updateStatusBySurrender(@Param("lastUpdateDate") Date lastUpdateDate,
                                 @Param("lastUpdatedBy") Integer lastUpdatedBy,
                                 @Param("fkRoomStatusId") String fkRoomStatusId,
                                 @Param("pkRoomId") String pkRoomId);

    /**
     * @Description: 批量修改房间状态
     * @author zhuliang
     * @date 2020/12/2 17:48
     */
    void batchUpdateStatusBySurrender(@Param("lastUpdateDate") Date lastUpdateDate,
                                      @Param("lastUpdatedBy") Integer lastUpdatedBy,
                                      @Param("fkRoomStatusId") String fkRoomStatusId,
                                      @Param("pkRoomId") String[] pkRoomId);



    /**
     * @Description: 根据税率模板id查询房间信息
     * @author zhuliang
     * @date 2020/12/5 16:11
     */
    List<CcmsSmartleasingRoom> getRoomByFeeRateTemplateId(@Param("fkTaxRateTemplateId") String fkTaxRateTemplateId);

    /**
     * @Description: 查询是否有相关税率模板与其关联的房间
     * @author zhuliang
     * @date 2020/12/5 16:39
     */
    String getByFeeRateTemplateId(@Param("fkTaxRateTemplateId") String fkTaxRateTemplateId);

    /**
     * @Description: 微信端-查询所有的招租信息
     * @author zhuliang
     * @date 2020/12/25 19:25
     */
    List<CcmsSmartleasingRoom> getAllByRent(@Param("firstPage") Integer firstPage,
                                            @Param("endPage") Integer endPage);

    /**
     * @Description: 微信端-条件查询招租信息
     * @author zhuliang
     * @date 2020/12/25 19:25
     */
    List<CcmsSmartleasingRoom> getAllByRentAndCondition(@Param("firstPage") Integer firstPage,
                                                        @Param("endPage") Integer endPage,
                                                        @Param("cityId") String cityId,
                                                        @Param("areaId") String areaId,
                                                        @Param("provinceId") String provinceId);

    /**
     * @Description: 微信端-根据房间id查询房间详细信息
     * @author zhuliang
     * @date 2020/12/25 19:23
     */
    CcmsSmartleasingRoom getDetailsByWechat(@Param("pkRoomId") String pkRoomId);

    /**
     * @Description: 房间编码唯一性验证
     * @author zhuliang
     * @date 2021/1/8 14:53
     */
    String codingUniquenessVerification(@Param("unitCoding") String unitCoding,
                                        @Param("waterCostCode") String waterCostCode,
                                        @Param("hotWaterCostCode") String hotWaterCostCode,
                                        @Param("electricCostCode") String electricCostCode,
                                        @Param("coalGasCostCode") String coalGasCostCode,
                                        @Param("pkRoomId") String pkRoomId);

    /**
     * @Description: 同楼宇同楼层房间号唯一性验证
     * @author zhuliang
     * @date 2021/1/27 11:41
     */
    String uniquenessVerificationByRoomNumber(@Param("houseNumber") String houseNumber,
                                              @Param("fkFloorId") String fkFloorId,
                                              @Param("fkBuildingId") String fkBuildingId,
                                              @Param("pkRoomId") String pkRoomId);
}
